/*    */ package com.zimbra.cs.index.query;
/*    */ 
/*    */ import com.zimbra.cs.index.DBQueryOperation;
/*    */ import com.zimbra.cs.index.QueryOperation;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import org.apache.lucene.analysis.Analyzer;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public final class SubjectQuery
/*    */   extends Query
/*    */ {
/*    */   private String subject;
/*    */   private boolean lt;
/*    */   private boolean inclusive;
/*    */   
/*    */   private SubjectQuery(String text)
/*    */   {
/* 42 */     this.lt = (text.charAt(0) == '<');
/* 43 */     this.inclusive = false;
/* 44 */     this.subject = text.substring(1);
/*    */     
/* 46 */     if (this.subject.charAt(0) == '=') {
/* 47 */       this.inclusive = true;
/* 48 */       this.subject = this.subject.substring(1);
/*    */     }
/*    */   }
/*    */   
/*    */   public static Query create(Analyzer analyzer, String text) {
/* 53 */     if ((text.length() > 1) && ((text.startsWith("<")) || (text.startsWith(">"))))
/*    */     {
/* 55 */       return new SubjectQuery(text);
/*    */     }
/* 57 */     return new TextQuery(analyzer, "subject", text);
/*    */   }
/*    */   
/*    */ 
/*    */   public boolean hasTextOperation()
/*    */   {
/* 63 */     return false;
/*    */   }
/*    */   
/*    */   public QueryOperation compile(Mailbox mbox, boolean bool)
/*    */   {
/* 68 */     DBQueryOperation op = new DBQueryOperation();
/* 69 */     if (this.lt) {
/* 70 */       op.addSubjectRange(null, false, this.subject, this.inclusive, evalBool(bool));
/*    */     } else {
/* 72 */       op.addSubjectRange(this.subject, this.inclusive, null, false, evalBool(bool));
/*    */     }
/* 74 */     return op;
/*    */   }
/*    */   
/*    */   public void dump(StringBuilder out)
/*    */   {
/* 79 */     out.append("SUBJECT:");
/* 80 */     out.append(this.lt ? '<' : '>');
/* 81 */     if (this.inclusive) {
/* 82 */       out.append('=');
/*    */     }
/* 84 */     out.append(this.subject);
/*    */   }
/*    */   
/*    */   public void sanitizedDump(StringBuilder out)
/*    */   {
/* 89 */     out.append("SUBJECT:");
/* 90 */     out.append(this.lt ? '<' : '>');
/* 91 */     if (this.inclusive) {
/* 92 */       out.append('=');
/*    */     }
/* 94 */     out.append("$TEXT");
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/index/query/SubjectQuery.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */